﻿using DevTeam;
using System;
namespace ConfExpert.Forms.Depo.Cikis
{
    public partial class TamponBolge : XPopupForm
    {
        public TamponBolge()
        {
            InitializeComponent();
        }

        private void TamponBolge_Load(object sender, EventArgs e)
        {            
            bbiEkle.ItemClick += bbiEkle_ItemClick;
            EnableBarcodeType(0);
            BarcodeRead += PO_BarcodeRead;
            this.Shown += TamponBolge_Shown;
        }

        void TamponBolge_Shown(object sender, EventArgs e)
        {
            memoEdit1.Focus();
        }

        void PO_BarcodeRead(int Type, int Barcode)
        {
            if (Type == 0)
            {
                if (!memoEdit1.Text.Contains(Barcode.ToString() + Environment.NewLine))
                    memoEdit1.Text += Barcode.ToString() + Environment.NewLine;
            }
        }

        public string RollIds = string.Empty;
        void bbiEkle_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string[] lst = memoEdit1.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            RollIds = String.Join(",", lst);
            ExecuteNonQuery("UpdTamponBolge", RollIds);
            Notify("Kaydedildi.");

            DialogResult = System.Windows.Forms.DialogResult.OK;
        }
    }
}
